#ifndef __ESP_AT_H
#define __ESP_AT_H

#include <stdint.h>
#include <stdbool.h>

typedef struct
{
    char ssid[64];
    char bssid[18];
    int channel;
    int rssi;
    bool connected;
} esp_wifi_info_t;

typedef struct
{
    char city[32];
    char location[128];
    char weather[16];
    int weather_code;
    float temperature;
} weather_info_t;

typedef struct
{
    uint16_t year;
    uint8_t month;
    uint8_t day;
    uint8_t hour;
    uint8_t minute;
    uint8_t second;
    uint8_t weekday;
} esp_date_time_t;

bool esp_at_write_command(const char* cmd, uint32_t time_out);
bool esp_at_init(void);
const char* esp_get_response(void);
bool esp_wifi_init(void);
bool esp_wifi_connect(const char* ssid, const char* pwd, const char* mac);
bool esp_at_get_wifi_info(esp_wifi_info_t* info);
bool esp_at_sntp_init(void);
bool esp_at_get_date_time(esp_date_time_t* date);
const char* esp_at_http_get(const char* url);
bool parse_seniverse_response(const char* response, weather_info_t* weather);
#endif /* __ESP_AT_H */
